<template>
  <div class="daily-report-container">
    <div class="header">
      <h1 class="title">日报管理</h1>
    </div>
    <div class="content">
      <van-button type="primary" block class="create-button">
        创建新日报
      </van-button>
      <div class="report-list">
        <van-card
          v-for="report in reports"
          :key="report.id"
          class="report-card"
        >
          <div class="report-header">
            <h3 class="report-date">{{ report.date }}</h3>
          </div>
          <div class="report-content">
            <h4 class="report-title">{{ report.title }}</h4>
            <p class="report-preview">{{ report.preview }}</p>
          </div>
          <div class="report-actions">
            <van-button size="small" type="primary" @click="viewReport(report.id)">查看</van-button>
            <van-button size="small" @click="editReport(report.id)">编辑</van-button>
          </div>
        </van-card>
      </div>
    </div>
    <van-tabbar v-model="activeTab" class="bottom-tabbar">
      <van-tabbar-item icon="home-o" text="首页" to="/home" />
      <van-tabbar-item icon="search" text="考试" to="/examList" />
      <van-tabbar-item icon="edit" text="日报" to="/dailyReport" />
      <van-tabbar-item icon="chat" text="论坛" to="/forum" />
      <van-tabbar-item icon="user" text="我的" to="/profile" />
    </van-tabbar>
  </div>
</template>

<script>

export default {
  name: 'DailyReport',
  data() {
    return {
      activeTab: 2,
      reports: [
        {
          id: 1,
          title: 'Java学习总结',
          date: '2024年1月15日',
          preview: '今天学习了Java的面向对象编程概念，包括类、对象、继承等核心概念。通过实际编程练习，对封装、继承、多态有了更深入的理解...'
        },
        {
          id: 2,
          title: '数据库设计实践',
          date: '2024年1月14日',
          preview: '完成了学生管理系统的数据库设计，包括学生表、课程表、成绩表的设计。学习了数据库范式和表关系的设计原则...'
        },
        {
          id: 3,
          title: '前端开发学习笔记',
          date: '2024年1月13日',
          preview: '学习了Vue.js框架的基础知识，包括组件化开发、数据绑定、事件处理等。通过实际项目练习，掌握了基本的开发流程...'
        }
      ]
    }
  },
  methods: {
    viewReport(id) {
      // 查看日报详情的逻辑
      console.log('查看日报:', id)
    },
    editReport(id) {
      // 编辑日报的逻辑
      console.log('编辑日报:', id)
    }
  }
}
</script>

<style scoped>
.daily-report-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #f5f5f5;
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 15px;
  text-align: center;
}

.title {
  font-size: 18px;
  font-weight: bold;
}

.content {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
}

.create-button {
  margin-bottom: 15px;
  background-color: #667eea;
}

.report-list {
  padding: 10px 0;
}

.report-card {
  margin-bottom: 15px;
  border-radius: 10px;
  overflow: hidden;
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.report-date {
  font-size: 16px;
  font-weight: bold;
  color: #333;
}

.report-content {
  margin-bottom: 15px;
}

.report-title {
  font-size: 14px;
  font-weight: bold;
  color: #333;
  margin-bottom: 5px;
}

.report-preview {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.bottom-tabbar {
  background-color: white;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}
</style>